/**
 * get/set turtlesim node params
*/
#include <ros/ros.h>
#include <std_srvs/Empty.h>

int main(int argc, char** argv) {
  ros::init(argc, argv, "parameter_config");

  int red_val, green_val, blue_val;

  ros::param::get("/turtlesim/background_r", red_val);
  ros::param::get("/turtlesim/background_g", green_val);
  ros::param::get("/turtlesim/background_b", blue_val);

  ROS_INFO("Get Turtlesim Background Color[%d, %d, %d]",
    red_val, green_val, blue_val);

  ros::param::set("/turtlesim/background_r", 255);
  ros::param::set("/turtlesim/background_g", 255);
  ros::param::set("/turtlesim/background_b", 255);

  ROS_INFO("Set Turtlesim Background Color[255, 255, 255]");

  ros::param::get("/turtlesim/background_r", red_val);
  ros::param::get("/turtlesim/background_g", green_val);
  ros::param::get("/turtlesim/background_b", blue_val);

  ROS_INFO("Re get Turtlesim Background Color[%d, %d, %d]",
    red_val, green_val, blue_val);

  // flush background color
  ros::NodeHandle nh;
  ros::service::waitForService("/clear");
  ros::ServiceClient clear_background_client = 
    nh.serviceClient<std_srvs::Empty>("/clear");
  std_srvs::Empty srv_data;
  clear_background_client.call(srv_data);

  sleep(1);

  return 0;
}
